// pages/main/me/me.js

Page({
  data: {
    isLogin: false,
    userInfo: null,
  },


  onLoad: function (options) {


  },


  onReady: function () {

  },


  onShow: function () {
    if (getApp().globalData.token && getApp().globalData.token.length > 0) {
      this.setData({
        isLogin: true
      });
      this.getUserInfo();
    } else {
      this.setData({
        isLogin: false
      });
    }
  },

  getUserInfo: function () {
    let that = this;
    getApp().$http.getUserInfo().then(res => {
      getApp().globalData.userInfo = res;
      that.setData({
        userInfo: res
      });

    });
  },


  onHide: function () {

  },

  btn_login: function () {
    getApp().$routes.goTo(getApp().$routes.loginPage);

  },

  btn_go_resume: function () {
    getApp().$routes.goTo(getApp().$routes.resume_firstenter);
  },

  btn_go_resume_detial: function () {
    getApp().$routes.goTo(getApp().$routes.resume_detial);
  },

  settingTab: function () {
    getApp().$routes.goTo(getApp().$routes.settingPage);
  },
  wattingInterviewTap: function () {
    getApp().$routes.goTo(getApp().$routes.interview_mananager, {
      "status": 0
    });
  },
  wattingEntryTap: function () {
    getApp().$routes.goTo(getApp().$routes.interview_mananager, {
      "status": 1
    });
  },

  myFavouriteTap: function () {
    getApp().$routes.goTo(getApp().$routes.myFavouritePage);
  },

  phoneCallTap: function () {
    wx.makePhoneCall({
      phoneNumber: '400-872-8880' 
    })
  },

  managerEmployment: function () {
    getApp().$routes.goTo(getApp().$routes.mananager_employment, {
      "code": "2"
    });
  },

  authentication: function(){

    let verified = this.data.userInfo.verified;
    if (verified){
      getApp().$routes.goTo(getApp().$routes.authentication_yet,{
        "verified": verified,
      })
    }else{
      getApp().$routes.goTo(getApp().$routes.authentication,{
        "verified": verified,
      })
    }
  },

  mycontract:function(){
    getApp().$routes.goTo(getApp().$routes.contract_index);
  },

  myBankCard: function () {
    let userInfo = this.data.userInfo;
    getApp().$routes.goTo(getApp().$routes.mybankcard,{"name": userInfo.name || userInfo.phoneNumber});
  },

  


})


